from Base.base import Base
from selenium.webdriver.common.by import By
from utils.data_header import read_yaml
import os

class Page2(Base):
    # 获取定位信息
    current_dir = os.path.dirname(__file__)
    test_case = read_yaml(os.path.join(current_dir, '..', 'Config', 'endpoints.yaml'))
    case = test_case[1]

    manage_loc=(By.XPATH,case['manage_loc'])

    def manage(self):
        self.click(self.manage_loc)

    productlist_loc=(By.XPATH,case['productlist_loc'])

    def productlist(self):
        self.click(self.productlist_loc)

    addproduct_loc=(By.CLASS_NAME,case['addproduct_loc'])

    def addproduct(self):
        self.click(self.addproduct_loc)

    encode_loc=(By.NAME,case['encode_loc'])

    def encode(self,encodes):
        self.send_keys(self.encode_loc,encodes)

    name_loc=(By.XPATH,case['name_loc'])

    def name(self,names):
        self.send_keys(self.name_loc,names)

    commit_loc=(By.XPATH,case['commit_loc'])

    def commit(self):
        self.click(self.commit_loc)




